<template>
	<view class="list">
		<view v-for="(list,listindex) in news" :key="listindex" class="listshow" @click="goDetail(list.id)">
			<image :src="list.cover" mode="heightFix" lazy-load></image>
			<text class="title">{{list.title}}</text>
			<view>{{list.desc}}</view>
			<p-price>
				<template #newPrice>
					<text class="p-price">￥<text>{{list.pprice}}</text></text>
				</template>
				<template #oldPrice>
					<text class="o-price">￥<text>{{list.oprice}}</text></text>
				</template>
			</p-price>
		</view>
	</view>
</template>

<script setup>
	defineProps(['news'])
	const goDetail = (id)=>{
		uni.navigateTo({
			url:`/pages/detail/detail?key=${id}`
		})
	}
</script>

<style scoped>
	.list {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		/* text-indent: 10rpx; */
	}

	.list .listshow {
		width: 50%;
		margin: 10rpx 0;
	}

	.list .listshow image {
		max-width: 100%;
		display: block;
		margin: 0 auto;
	}

	.list .listshow view {
		white-space: normal;
		word-break: break-all;
		word-warp: break-word;
		font-size: 28rpx;
	}

	.list .listshow .title {
		display: inline-block;
		/* padding:16rpx 0 10rpx 0; */
		font-size: 32rpx;
		font-weight: 700;
	}

	.p-price {
		font-size: 20rpx;
		color: #f60;
	}

	.p-price text {
		font-size: 34rpx;
		color: #f60;
		font-weight: 900;
	}

	.o-price {
		font-size: 20rpx;
		color: #ccc;
		text-decoration: line-through;
	}

	.o-price text {
		font-size: 30rpx;
		color: #ccc;
	}
</style>